<!--

    Copyright (c) 2015 Codenvy, S.A.
    All rights reserved. This program and the accompanying materials
    are made available under the terms of the Eclipse Public License v1.0
    which accompanies this distribution, and is available at
    http://www.eclipse.org/legal/epl-v10.html

    Contributors:
      Codenvy, S.A. - initial API and implementation

-->
<che-list-item flex ng-mouseover="hover=true" ng-mouseout="hover=false">
  <div flex="100"
       layout="row"
       layout-align="start stretch"
       class="che-list-item-row">
    <div layout="row"
         layout-align="start center"
         class="che-checkbox-area"
         ng-if="workspaceItemCtrl.isSelectable === true">
      <che-list-item-checked ng-model="workspaceItemCtrl.isSelect"
                             ng-show="('RUNNING' === workspaceItemCtrl.getWorkspaceStatus() || 'STOPPED' === workspaceItemCtrl.getWorkspaceStatus())"
                             che-aria-label-checkbox="Workspace {{workspaceItemCtrl.workspace.config.name}}"
                             ng-click="workspaceItemCtrl.onCheckboxClick()"></che-list-item-checked>
    </div>
    <div flex
         layout-xs="column" layout-gt-xs="row"
         layout-align-gt-xs="start center"
         layout-align-xs="start start"
         class="che-list-item-details">
      <div flex-gt-xs="25"
           class="che-list-item-name"
           ng-click="workspaceItemCtrl.redirectToWorkspaceDetails();">
        <span class="che-xs-header noselect" hide-gt-xs>Name</span>
        <workspace-status-indicator che-status="workspaceItemCtrl.getWorkspaceStatus()"></workspace-status-indicator>
        <span tooltip="{{'RUNNING' === workspaceItemCtrl.getWorkspaceStatus() ? 'Running' : 'Last modified: ' + (workspaceItemCtrl.workspace.attributes.updated | amTimeAgo)}}"
              class="che-hover">{{workspaceItemCtrl.workspace.config.name}}</span>
        <i class="fa fa-clock-o workspace-item-temp" ng-if="workspaceItemCtrl.workspace.temporary"></i>
      </div>
      <div flex-gt-xs="15"
           lass="che-list-item-name"
           ng-click="workspaceItemCtrl.redirectToWorkspaceDetails();">
        <span class="che-xs-header noselect" hide-gt-xs>RAM</span>
        <span class="workspace-consumed-value">{{workspaceItemCtrl.getDefaultEnvironment(workspaceItemCtrl.workspace).machineConfigs[0].limits.ram}} MB</span>
      </div>
      <div flex-gt-xs="15"
           class="che-list-item-name"
           ng-click="workspaceItemCtrl.redirectToWorkspaceDetails();">
        <span class="che-xs-header noselect" hide-gt-xs>Projects</span>
        <span class="che-hover">{{workspaceItemCtrl.workspace.config.projects.length}}</span>
      </div>
      <div flex-gt-xs="30"
           class="che-list-item-name"
           ng-click="workspaceItemCtrl.redirectToWorkspaceDetails();">
        <span class="che-xs-header noselect" hide-gt-xs>Stack</span>
        <span class="che-hover">{{workspaceItemCtrl.workspace.attributes.stackId}}</span>
      </div>
      <div flex-gt-xs="15">
        <span class="che-xs-header noselect" hide-gt-xs>Actions</span>
        <span class="che-list-actions">
          <che-workspace-status che-workspace-item="workspaceItemCtrl.workspace"></che-workspace-status>
          <a ng-href="#/workspace/{{workspaceItemCtrl.workspace.namespace}}/{{workspaceItemCtrl.workspace.config.name}}/projects"
             tooltip="Configure workspace">
            <span class="fa fa-cog"></span>
          </a>
          <a ng-href="#/create-project?workspaceId={{workspaceItemCtrl.workspace.id}}" tooltip="Add project">
            <span class="fa fa-plus-square-o"></span>
          </a>
        </span>
      </div>
    </div>
  </div>
</che-list-item>
